<template>
  <el-dialog title="新增" :close-on-click-modal="false" :visible.sync="visible" center fullscreen>
    <el-button class="miui-dialog-close-btn" @click="visible = false">关闭页面</el-button>
    <el-form class="verify-form" :model="dataForm" ref="dataForm" label-width="90px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="配镜单号" prop="saleBillId">
            <el-input v-model="dataForm.saleBillId" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="所属部门" prop="deptName">
            <el-input v-model="dataForm.deptName" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="加工要求" prop="workRequest">
            <el-input v-model="dataForm.workRequest" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="顾客姓名" prop="customerName">
            <el-input v-model="dataForm.customerName" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="联系电话" prop="customerPhone">
            <el-input v-model="dataForm.customerPhone" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="关联顾客卡" prop="customerCard">
            <el-input v-model="dataForm.customerCard" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="加工师" prop="workUserName">
            <el-input v-model="dataForm.workUserName" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="检验员" prop="checkUserName">
            <el-input v-model="checkName" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="配送地点" prop="takeMirroDeptName">
            <el-input v-model="dataForm.takeMirroDeptName" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="备注" prop="memo">
            <el-input type="textarea" v-model="dataForm.memo"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider content-position="center">视光详情</el-divider>
      <table class="miui-table miui-table-check">
        <tr>
          <th width="120">右眼(R)/左眼(L)</th>
          <th width="120">子午面</th>
          <th>球镜</th>
          <th>柱镜</th>
          <th>轴向</th>
          <th colspan='2'>斜视</th>
          <th>add</th>
          <th>瞳距</th>
          <th>瞳高</th>
          <th width="180">商品名称</th>
        </tr>
        <tr>
          <td rowspan='4'>R</td>
          <td>主子午面一</td>
          <td>{{saleOptometry.ballGlassOd}}</td>
          <td>{{saleOptometry.postGlassOd}}</td>
          <td>{{saleOptometry.axesOd}}</td>
          <td colspan='2'>视光类</td>
          <td>{{saleOptometry.addOd}}</td>

          <td v-if="parseFloat(saleOptometry.farPupilDistanceOd)">{{saleOptometry.farPupilDistanceOd}}</td>
          <td v-else="parseFloat(saleOptometry.nearPupilDistanceOd)">{{saleOptometry.nearPupilDistanceOd}}</td>

          <td v-if="saleOptometry.nearPupilDistanceOd">{{saleOptometry.pupilHighOd}}</td>
          <td v-else>0</td>
          <td rowspan='4'>{{dataForm.rightViewGoodsName}}</td>
        </tr>
        <tr>
          <td>焦度计</td>
          <td>
            <el-form-item prop="vertometerBallGlassOd" label-width="0">
              <el-input v-model="dataForm.vertometerBallGlassOd" name="opto" id="opto1" ref="vertometerBallGlassOd"
                @change="assignmentZT" @keyup.enter.native="enterChange(2)"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item prop="vertometerPostGlassOd" label-width="0">
              <el-input v-model="dataForm.vertometerPostGlassOd" name="opto" id="opto2" ref="vertometerPostGlassOd"
                @change="assignmentZT" @keyup.enter.native="enterChange(3)"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item prop="vertometerAxesOd" label-width="0">
              <el-input v-model="dataForm.vertometerAxesOd" name="opto" id="opto3" ref="vertometerAxesOd" @change="assignmentZT"
                @keyup.enter.native="enterChange(4)"></el-input>
            </el-form-item>
          </td>
          <td rowspan='3' colspan='2'>
            <el-row>
              <el-form-item label="三棱镜" label-width="60px">
                <el-input v-model="dataForm.cokeArriseGlassOd" id="opto4" @keyup.enter.native="enterChange(6)"></el-input>
              </el-form-item>

            </el-row>
            <el-row>
              <el-form-item label="基底" label-width="60px">
                <el-select v-model="dataForm.cokeBasisOd" id="opto5">
                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>

            </el-row>
          </td>
          <td rowspan='3'>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerAddOd" name="opto" id="opto6" ref="vertometerAddOd"
                @keyup.enter.native="enterChange(7)"></el-input>
            </el-form-item>
          </td>
          <td rowspan='3'>
            <el-form-item prop="vertometerPupilDistanceOd" label-width="0">
              <el-input v-model="dataForm.vertometerPupilDistanceOd" name="opto" id="opto7" ref="vertometerPupilDistanceOd"
                @keyup.enter.native="enterChange(9)"></el-input>
            </el-form-item>
          </td>
          <td rowspan='3'>
            <el-form-item prop="vertometerPupilHighOd" label-width="0">
              <el-input v-model="dataForm.vertometerPupilHighOd" id="opto8"></el-input>
            </el-form-item>
          </td>

        </tr>
        <tr>
          <td>主子午面二</td>
          <td>{{ballGlassOd2}}</td>
          <td>{{postGlassOd2}}</td>
          <td>{{axesOd2}}</td>
        </tr>
        <tr>
          <td>焦度计</td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerBallGlassOd2" name="opto" ref="vertometerBallGlassOd2" readonly></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerPostGlassOd2" name="opto" ref="vertometerPostGlassOd2" readonly></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerAxesOd2" name="opto" ref="vertometerAxesOd2" readonly></el-input>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td rowspan='4'>L</td>
          <td>主子午面一</td>
          <td>{{saleOptometry.ballGlassOs}}</td>
          <td>{{saleOptometry.postGlassOs}}</td>
          <td>{{saleOptometry.axesOs}}</td>
          <td colspan='2'>视光类</td>
          <td>{{saleOptometry.addOs}}</td>

          <td v-if="parseFloat(saleOptometry.farPupilDistanceOs)">{{saleOptometry.farPupilDistanceOs}}</td>
          <td v-else="parseFloat(saleOptometry.nearPupilDistanceOs)">{{saleOptometry.nearPupilDistanceOs}}</td>
          <td v-if="saleOptometry.nearPupilDistanceOs">{{saleOptometry.pupilHighOs}}</td>
          <td v-else>0</td>
          <td rowspan='4'>{{dataForm.leftViewGoodsName}}</td>
        </tr>
        <tr>
          <td>焦度计</td>
          <td>
            <el-form-item prop="vertometerBallGlassOs" label-width="0">
              <el-input v-model="dataForm.vertometerBallGlassOs" name="opto" id="opto9" ref="vertometerBallGlassOs"
                @change="assignmentZT" @keyup.enter.native="enterChange(10)"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item prop="vertometerPostGlassOs" label-width="0">
              <el-input v-model="dataForm.vertometerPostGlassOs" name="opto" id="opto10" ref="vertometerPostGlassOs"
                @change="assignmentZT" @keyup.enter.native="enterChange(11)"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item prop="vertometerAxesOs" label-width="0">
              <el-input v-model="dataForm.vertometerAxesOs" name="opto" id="opto11" ref="vertometerAxesOs" @change="assignmentZT"
                @keyup.enter.native="enterChange(12)"></el-input>
            </el-form-item>
          </td>
          <td rowspan='3' colspan='2'>
            <el-row>
              <el-form-item label="三棱镜" label-width="60px">
                <el-input v-model="dataForm.cokeArriseGlassOs" id="opto12" @keyup.enter.native="enterChange(14)"></el-input>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item label="基底" label-width="60px">
                <el-select v-model="dataForm.cokeBasisOs" id="opto13">
                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-row>
          </td>
          <td rowspan='3'>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerAddOs" name="opto" id="opto14" ref="vertometerAddOs"
                @keyup.enter.native="enterChange(15)"></el-input>
            </el-form-item>
          </td>
          <td rowspan='3'>
            <el-form-item prop="vertometerPupilDistanceOs" label-width="0">
              <el-input v-model="dataForm.vertometerPupilDistanceOs" name="opto" id="opto15" ref="vertometerPupilDistanceOs"
                @keyup.enter.native="enterChange(17)"></el-input>
            </el-form-item>
          </td>
          <td rowspan='3'>
            <el-form-item prop="vertometerPupilHighOs" label-width="0">
              <el-input v-model="dataForm.vertometerPupilHighOs" id="opto16"></el-input>
            </el-form-item>
          </td>

        </tr>
        <tr>
          <td>主子午面二</td>
          <td>{{ballGlassOs2}}</td>
          <td>{{postGlassOs2}}</td>
          <td>{{axesOs2}}</td>
        </tr>
        <tr>
          <td>焦度计</td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerBallGlassOs2" name="opto" ref="vertometerBallGlassOs2" readonly></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerPostGlassOs2" name="opto" ref="vertometerPostGlassOs2" readonly></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.vertometerAxesOs2" name="opto" ref="vertometerAxesOs2" readonly></el-input>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>镜架</td>
          <td colspan="10">
            {{dataForm.frameName}}
          </td>
        </tr>
      </table>
      <table class="miui-table miui-table-check">
        <tr>
          <th>光心垂差</th>
          <th>光心垂差(焦度计)</th>
          <th>光心高度描述</th>
          <th>色泽互差描述</th>
          <th>装配质量描述</th>
          <th>整形描述</th>
        </tr>
        <tr>
          <td>
            {{centerVertical}}
          </td>
          <td>
            <el-form-item prop="cokeCenterVertical" label-width="0">
              <el-input v-model="dataForm.cokeCenterVertical" name="opto" id="opto17" ref="cokeCenterVertical"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.centerHigh"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.color"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.quality"></el-input>
            </el-form-item>
          </td>
          <td>
            <el-form-item label-width="0">
              <el-input v-model="dataForm.shape"></el-input>
            </el-form-item>
          </td>
        </tr>
      </table>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button type="info" @click="check">检 验</el-button>
      <el-button type="primary" @click="dataFormSubmit" :loading="ischeck" v-prevent-re-click>确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  import { getBySaleId, workCheckAddObj } from '@/api/eims/formalInspect'
  import { accAdd, Subtr } from '@/util/tools'
  import { mapGetters } from 'vuex'

  export default {
    data() {
      var cokeCenterVerticalRule = (rule, value, callback) => {
        if (!value) {
          return callback(new Error('光心垂差(焦度计)不能为空'));
        }
        if (((this.centerVertical * 1) < (value * 1)) || ((value * 1) < 0)) {
          return callback(new Error('请输入正确的光心垂差(焦度计)数值,范围在0-' + this.centerVertical + '之间'));
        }
        callback()
      }
      return {
        ischeck: false,
        visible: false,
        toleranceData: {
          sphodmis: '',
          sphosmis: '',
          cylodmis: '',
          cylosmis: '',
          axesodmis: '',
          axesosmis: '',
          addodmis: '',
          addosmis: '',
          tjodmis: '',
          tjosmis: '',
        },
        dataForm: {
          id: 0,
          saleId: '',
          saleBillId: '',
          cokeBallGlassOd: '',
          cokeBallGlassOd2: '',
          vertometerBallGlassOd: '',
          vertometerBallGlassOd2: '',
          cokeBallGlassOs: '',
          cokeBallGlassOs2: '',
          vertometerBallGlassOs: '',
          vertometerBallGlassOs2: '',
          cokePostGlassOd: '',
          cokePostGlassOd2: '',
          vertometerPostGlassOd: '',
          vertometerPostGlassOd2: '',
          cokePostGlassOs: '',
          cokePostGlassOs2: '',
          vertometerPostGlassOs: '',
          vertometerPostGlassOs2: '',
          cokeAxesOd: '',
          cokeAxesOd2: '',
          vertometerAxesOd: '',
          vertometerAxesOd2: '',
          cokeAxesOs: '',
          cokeAxesOs2: '',
          vertometerAxesOs: '',
          vertometerAxesOs2: '',
          cokeArriseGlassOd: '',
          cokeArriseGlassOs: '',
          cokeBasisOd: '',
          cokeBasisOs: '',
          cokeAddOd: '',
          vertometerAddOd: '',
          cokeAddOs: '',
          vertometerAddOs: '',
          cokePupilDistanceOd: '',
          vertometerPupilDistanceOd: '',
          cokePupilDistanceOs: '',
          vertometerPupilDistanceOs: '',
          centerVertical: '',
          cokeCenterVertical: '',
          centerHigh: '√',
          color: '√',
          quality: '√',
          shape: '√',
          workDeptId: '',
          workUserName: '',
          checkUserName: '',
          memo: ''
        },
        options: [{
            value: '1',
            label: '内'
          },
          {
            value: '2',
            label: '外'
          },
          {
            value: '3',
            label: '上'
          },
          {
            value: '4',
            label: '下'
          },
        ],
        saleOptometry: {}
      }
    },
    computed: {
      ...mapGetters(['permissions', 'userInfo']),
      ballGlassOd2: function() {
        let num = ''
        if ((parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)) > 0) {
          num = '+' + (parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)).toFixed(
            2)
        } else {
          num = (parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)).toFixed(2)
        }
        return num || '0.00'
      },
      postGlassOd2: function() {
        let num = ''
        if ((parseFloat(this.saleOptometry.postGlassOd) * -1) > 0) {
          num = '+' + (parseFloat(this.saleOptometry.postGlassOd) * -1).toFixed(2)
        } else {
          num = (parseFloat(this.saleOptometry.postGlassOd) * -1).toFixed(2)
        }
        return num || '0.00'
      },
      axesOd2: function() {
        if (this.saleOptometry.axesOd) {
          return parseFloat(this.saleOptometry.axesOd) >= 90 ? parseFloat(this.saleOptometry.axesOd) - 90 : parseFloat(this.saleOptometry.axesOd) + 90
        }
      },
      ballGlassOs2: function() {
        let num = ''
        if ((parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)) > 0) {
          num = '+' + (parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)).toFixed(
            2)
        } else {
          num = (parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)).toFixed(2)
        }
        return num || '0.00'
      },
      postGlassOs2: function() {
        let num = ''
        if ((parseFloat(this.saleOptometry.postGlassOs) * -1) > 0) {
          num = '+' + (parseFloat(this.saleOptometry.postGlassOs) * -1).toFixed(2)
        } else {
          num = (parseFloat(this.saleOptometry.postGlassOs) * -1).toFixed(2)
        }
        return num || '0.00'
      },
      axesOs2: function() {
        if (this.saleOptometry.axesOs) {
          return parseFloat(this.saleOptometry.axesOs) >= 90 ? parseFloat(this.saleOptometry.axesOs) - 90 :
            parseFloat(this.saleOptometry.axesOs) + 90
        }
      },
      checkName: function() {
        return this.userInfo.username
      },
      centerVertical: function() {
        let val1 = Math.abs(this.saleOptometry.ballGlassOd) >= Math.abs(this.ballGlassOd2) ? Math.abs(this.saleOptometry
          .ballGlassOd) : Math.abs(this.ballGlassOd2)
        let val2 = val1 >= Math.abs(this.saleOptometry.ballGlassOs) ? val1 : Math.abs(this.saleOptometry.ballGlassOs)
        let val3 = val2 >= Math.abs(this.ballGlassOs2) ? val2 : Math.abs(this.ballGlassOs2)
        if (val3 >= 0 && val3 <= 0.5) {
          return "0.50";
        } else if (val3 >= 0.75 && val3 <= 1.00) {
          return "3.00";
        } else if (val3 >= 1.25 && val3 <= 2.50) {
          return "2.00";
        } else if (val3 > 2.50) {
          return "1.00";
        }
      }
    },
    methods: {
      init(saleId) {
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          getBySaleId(saleId).then(response => {
            if(response.data.code == '0'){
              this.dataForm = response.data.data
              this.dataForm.centerHigh = "√"
              this.dataForm.color = "√"
              this.dataForm.quality = "√"
              this.dataForm.shape = "√"
              this.saleOptometry = response.data.data.saleOptometry
              for (let key in this.saleOptometry) {
                if (!this.saleOptometry[key]) {
                  if (['ballGlassOd', 'ballGlassOs', 'postGlassOd', 'postGlassOs'].includes(key)) {
                    this.saleOptometry[key] = '0.00'
                  } else {
                    this.saleOptometry[key] = '0'
                  }
                } else {
                  if (['ballGlassOd', 'ballGlassOs', 'postGlassOd', 'postGlassOs'].includes(key)) {
                    if (this.saleOptometry[key] > 0) {
                      this.saleOptometry[key] = '+' + (this.saleOptometry[key] * 1).toFixed(2)
                    } else {
                      this.saleOptometry[key] = (this.saleOptometry[key] * 1).toFixed(2)
                    }
                  }
                }
              }
              this.saleOptometry = {...this.saleOptometry}
            }else{
              this.$message.error(response.data.msg)
            }
          })
          let optoList = document.getElementsByName('opto')
          optoList.forEach(item => {
            item.style.backgroundColor = '#fff'
          })
        })
      },
      takeValue(arg1, arg2) {
        return Math.max(Math.abs(arg1), Math.abs(arg2))
      },
      //  计算球镜允差
      ballGlassCount(num) {
        if (0 <= num && num <= 9.00) {
          return 0.12
        } else if (9.00 < num && num <= 12.00) {
          return 0.18
        } else if (12.00 < num && num <= 20.00) {
          return 0.25
        } else if (20.00 < num) {
          return 0.37
        }
      },
      //  计算柱镜允差
      postGlassCount(num1, num2) {
        if (0 <= num1 && num1 <= 3.00 && 0 <= num2 && num2 <= 0.75) {
          return 0.09
        }
        if (3.00 < num1 && num1 <= 12 && 0 <= num2 && num2 <= 0.75) {
          return 0.12
        }
        if (0 <= num1 && num1 <= 6 && 0.75 < num2 && num2 <= 4) {
          return 0.12
        }
        if (12 < num1 && num1 <= 20 && 0 <= num2 && num2 <= 0.75) {
          return 0.18
        }
        if (6 < num1 && num1 <= 12 && 0.75 < num2 && num2 <= 4) {
          return 0.18
        }
        if (0 <= num1 && num1 <= 9 && 4 < num2 && num2 <= 6) {
          return 0.18
        }
        if (0 <= num1 && num1 <= 20 && 6.00 < num2) {
          return 0.25
        }
        if (9 < num1 && num1 <= 20 && 4 < num2 && num2 <= 6) {
          return 0.25
        }
        if (12 < num1 && 0.75 < num2 && num2 <= 4) {
          return 0.18
        }
        if (20 < num1 && 0 <= num2 && num2 <= 0.75) {
          return 0.18
        }
        if (20 < num1 && 4 < num2) {
          return 0.37
        }
      },
      //  计算轴位允差
      axesCount(num) {
        if (num <= 0.5) {
          return 7
        } else if (0.5 < num && num <= 0.75) {
          return 5
        } else if (0.75 < num && num <= 1.5) {
          return 3
        } else if (1.5 < num) {
          return 2
        }
      },
      //  计算add允差
      addCount(num) {
        if (num <= 4) {
          return 0.12
        } else if (4 < num) {
          return 0.18
        }
      },
      //  计算瞳距允差
      tjCount(num) {
        if (0 <= num && num <= 0.5) {
          return 6
        } else if (0.75 <= num && num <= 1) {
          return 6
        } else if (1.25 <= num && num <= 2) {
          return 4
        } else if (2.25 <= num && num <= 4) {
          return 3
        } else if (4.25 <= num) {
          return 2
        }
      },
      //  计算允差值
      toleranceCount() {
        this.toleranceData.sphodmis = this.ballGlassCount(this.takeValue(this.saleOptometry.ballGlassOd, this.ballGlassOd2))
        this.toleranceData.sphosmis = this.ballGlassCount(this.takeValue(this.saleOptometry.ballGlassOs, this.ballGlassOs2))
        this.toleranceData.cylodmis = this.postGlassCount(this.takeValue(this.saleOptometry.ballGlassOd, this.ballGlassOd2),
          this.takeValue(this.saleOptometry.postGlassOd, this.postGlassOd2))
        this.toleranceData.cylosmis = this.postGlassCount(this.takeValue(this.saleOptometry.ballGlassOs, this.ballGlassOs2),
          this.takeValue(this.saleOptometry.postGlassOs, this.postGlassOs2))
        this.toleranceData.axesodmis = this.axesCount(Math.abs(this.saleOptometry.postGlassOd))
        this.toleranceData.axesosmis = this.axesCount(Math.abs(this.saleOptometry.postGlassOs))

        this.toleranceData.addodmis = this.addCount(Math.abs(this.saleOptometry.addOd))
        this.toleranceData.addosmis = this.addCount(Math.abs(this.saleOptometry.addOs))

        this.toleranceData.tjodmis = this.tjCount(this.takeValue(this.saleOptometry.ballGlassOd, this.ballGlassOd2))
        this.toleranceData.tjosmis = this.tjCount(this.takeValue(this.saleOptometry.ballGlassOs, this.ballGlassOs2))
      },
      //
      assignmentZT() {
        //  R子午面二
        if ((this.dataForm.vertometerBallGlassOd || this.dataForm.vertometerBallGlassOd == 0) && (this.dataForm.vertometerBallGlassOd || this.dataForm.vertometerBallGlassOd == 0) && (this.dataForm.vertometerAxesOd || this.dataForm.vertometerAxesOd == 0)) {
          this.dataForm.vertometerBallGlassOd2 = (parseFloat(this.dataForm.vertometerBallGlassOd) + parseFloat(this.dataForm .vertometerPostGlassOd)).toFixed(2)
          this.dataForm.vertometerPostGlassOd2 = (parseFloat(this.dataForm.vertometerPostGlassOd) * parseFloat(-1)).toFixed(2)
          this.dataForm.vertometerAxesOd2 = this.dataForm.vertometerAxesOd <= 90 ? (parseFloat(this.dataForm.vertometerAxesOd) + parseFloat(90)) : (parseFloat(this.dataForm.vertometerAxesOd) - parseFloat(90))
        }
        //	L子午面二
        if (this.dataForm.vertometerBallGlassOs != '' && this.dataForm.vertometerPostGlassOs != '' && this.dataForm.vertometerAxesOs != '') {
          this.dataForm.vertometerBallGlassOs2 = (parseFloat(this.dataForm.vertometerBallGlassOs) + parseFloat(this.dataForm.vertometerPostGlassOs)).toFixed(2)
          this.dataForm.vertometerPostGlassOs2 = (parseFloat(this.dataForm.vertometerPostGlassOs) * parseFloat(-1)).toFixed(2)
          this.dataForm.vertometerAxesOs2 = this.dataForm.vertometerAxesOs <= 90 ? (parseFloat(this.dataForm.vertometerAxesOs) + parseFloat(90)) : (parseFloat(this.dataForm.vertometerAxesOs) - parseFloat(90))
        }
        if (isNaN(this.dataForm.vertometerBallGlassOd2)) {
          this.dataForm.vertometerBallGlassOd2 = ''
        }
        if (isNaN(this.dataForm.vertometerPostGlassOd2)) {
          this.dataForm.vertometerPostGlassOd2 = ''
        }
        if (isNaN(this.dataForm.vertometerAxesOd2)) {
          this.dataForm.vertometerAxesOd2 = ''
        }
        if (isNaN(this.dataForm.vertometerBallGlassOs2)) {
          this.dataForm.vertometerBallGlassOs2 = ''
        }
        if (isNaN(this.dataForm.vertometerPostGlassOs2)) {
          this.dataForm.vertometerPostGlassOs2 = ''
        }
        if (isNaN(this.dataForm.vertometerAxesOs2)) {
          this.dataForm.vertometerAxesOs2 = ''
        }
        this.dataForm = { ...this.dataForm }
      },
      //  检验
      check() {
        this.toleranceCount()
        //  右眼球镜--子午面1
        if (!isNaN(this.dataForm.vertometerBallGlassOd)) {
          if (this.dataForm.vertometerBallGlassOd.substring(0, 1) == this.saleOptometry.ballGlassOd.substring(0, 1) ||
            this.saleOptometry.ballGlassOd.substring(0, 1) == '+') {

            if (Math.abs(Subtr(this.dataForm.vertometerBallGlassOd, this.saleOptometry.ballGlassOd)) > this.toleranceData
              .sphodmis || this.dataForm.vertometerBallGlassOd == '') {
              this.$refs['vertometerBallGlassOd'].$refs.input.focus()
              this.$refs['vertometerBallGlassOd'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOd'].$refs.input.style.backgroundColor = 'green'
            }
          } else if (this.saleOptometry.ballGlassOd == '0.00') {
            if (Math.abs(Subtr(this.dataForm.vertometerBallGlassOd, this.saleOptometry.ballGlassOd)) > this.toleranceData
              .sphodmis || this.dataForm.vertometerBallGlassOd == '') {
              this.$refs['vertometerBallGlassOd'].$refs.input.focus()
              this.$refs['vertometerBallGlassOd'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOd'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerBallGlassOd'].$refs.input.focus()
            this.$refs['vertometerBallGlassOd'].$refs.input.style.backgroundColor = 'red'
          }
        } else {
          this.$refs['vertometerBallGlassOd'].$refs.input.focus()
          this.$refs['vertometerBallGlassOd'].$refs.input.style.backgroundColor = 'red'
        }
        //  右眼球镜--子午面2
        if (!isNaN(this.dataForm.vertometerBallGlassOd2) && this.dataForm.vertometerBallGlassOd2 != '') {
          if (this.dataForm.vertometerBallGlassOd2.substring(0, 1) == (parseFloat(this.saleOptometry.ballGlassOd) +
              parseFloat(this.saleOptometry.postGlassOd) + "").substring(0, 1) || (parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)) > 0) {
            if (Math.abs(Subtr(this.dataForm.vertometerBallGlassOd2, (parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)))) > this.toleranceData.sphodmis || this.dataForm.vertometerBallGlassOd2
              .trim() == '') {
              this.$refs['vertometerBallGlassOd2'].$refs.input.focus()
              this.$refs['vertometerBallGlassOd2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOd2'].$refs.input.style.backgroundColor = 'green'
            }
          } else if ((parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)) == 0) {
            if (Math.abs(Subtr(this.dataForm.vertometerBallGlassOd2, (parseFloat(this.saleOptometry.ballGlassOd) + parseFloat(this.saleOptometry.postGlassOd)))) > this.toleranceData.sphodmis || this.dataForm.vertometerBallGlassOd2.trim() == '') {
              this.$refs['vertometerBallGlassOd2'].$refs.input.focus()
              this.$refs['vertometerBallGlassOd2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOd2'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerBallGlassOd2'].$refs.input.focus()
            this.$refs['vertometerBallGlassOd2'].$refs.input.style.backgroundColor = 'red'
          }
        } else {
          this.$refs['vertometerBallGlassOd2'].$refs.input.focus()
          this.$refs['vertometerBallGlassOd2'].$refs.input.style.backgroundColor = 'red'
        }
        //  左眼球镜--子午面1
        if (!isNaN(this.dataForm.vertometerBallGlassOs)) {
          if (this.dataForm.vertometerBallGlassOs.substring(0, 1) == this.saleOptometry.ballGlassOs.substring(0, 1) ||
            this.saleOptometry.ballGlassOs.substring(0, 1) == '+') {
            if (Math.abs(Subtr(parseFloat(this.dataForm.vertometerBallGlassOs), parseFloat(this.saleOptometry.ballGlassOs))) > this.toleranceData.sphosmis || this.dataForm.vertometerBallGlassOs == '') {
              this.$refs['vertometerBallGlassOs'].$refs.input.focus()
              this.$refs['vertometerBallGlassOs'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOs'].$refs.input.style.backgroundColor = 'green'
            }
          } else if (this.saleOptometry.ballGlassOs == '0.00') {
            if (Math.abs(Subtr(parseFloat(this.dataForm.vertometerBallGlassOs), parseFloat(this.saleOptometry.ballGlassOs))) > this.toleranceData.sphosmis || this.dataForm.vertometerBallGlassOs == '') {
              this.$refs['vertometerBallGlassOs'].$refs.input.focus()
              this.$refs['vertometerBallGlassOs'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOs'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerBallGlassOs'].$refs.input.focus()
            this.$refs['vertometerBallGlassOs'].$refs.input.style.backgroundColor = 'red'
          }
        } else {
          this.$refs['vertometerBallGlassOs'].$refs.input.focus()
          this.$refs['vertometerBallGlassOs'].$refs.input.style.backgroundColor = 'red'
        }
        //  左眼球镜--子午面2
        if (!isNaN(this.dataForm.vertometerBallGlassOs2) && this.dataForm.vertometerBallGlassOs2 != '') {
          if (this.dataForm.vertometerBallGlassOs2.substring(0, 1) == (parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs) + "").substring(0, 1) || (parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)) > 0) {
            if (Math.abs(Subtr(this.dataForm.vertometerBallGlassOs2, (parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)))) > this.toleranceData.sphosmis || this.dataForm.vertometerBallGlassOs2.trim() === '') {
              this.$refs['vertometerBallGlassOs2'].$refs.input.focus()
              this.$refs['vertometerBallGlassOs2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOs2'].$refs.input.style.backgroundColor = 'green'
            }
          } else if ((parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)) == 0) {
            if (Math.abs(Subtr(this.dataForm.vertometerBallGlassOs2, (parseFloat(this.saleOptometry.ballGlassOs) + parseFloat(this.saleOptometry.postGlassOs)))) > this.toleranceData.sphosmis || this.dataForm.vertometerBallGlassOs2.trim() === '') {
              this.$refs['vertometerBallGlassOs2'].$refs.input.focus()
              this.$refs['vertometerBallGlassOs2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerBallGlassOs2'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerBallGlassOs2'].$refs.input.focus()
            this.$refs['vertometerBallGlassOs2'].$refs.input.style.backgroundColor = 'red'
          }
        } else {
          this.$refs['vertometerBallGlassOs2'].$refs.input.focus()
          this.$refs['vertometerBallGlassOs2'].$refs.input.style.backgroundColor = 'red'
        }
        //  右眼柱镜
        if (!isNaN(this.dataForm.vertometerPostGlassOd) && (this.saleOptometry.postGlassOd || this.saleOptometry.postGlassOd == 0)) {
          if (this.dataForm.vertometerPostGlassOd.substring(0, 1) == this.saleOptometry.postGlassOd.substring(0, 1) || this.saleOptometry.postGlassOd.substring(0, 1) == '+') {
            if (Math.abs(Subtr(this.saleOptometry.postGlassOd, this.dataForm.vertometerPostGlassOd)) > this.toleranceData.cylodmis || this.saleOptometry.postGlassOd === '') {
              this.$refs['vertometerPostGlassOd'].$refs.input.focus()
              this.$refs['vertometerPostGlassOd'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerPostGlassOd2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPostGlassOd'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerPostGlassOd2'].$refs.input.style.backgroundColor = 'green'
            }
          } else if (this.saleOptometry.postGlassOd == 0) {
            if (Math.abs(Subtr(this.saleOptometry.postGlassOd, this.dataForm.vertometerPostGlassOd)) > this.toleranceData.cylodmis || this.saleOptometry.postGlassOd == '') {
              this.$refs['vertometerPostGlassOd'].$refs.input.focus()
              this.$refs['vertometerPostGlassOd'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerPostGlassOd2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPostGlassOd'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerPostGlassOd2'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerPostGlassOd'].$refs.input.focus()
            this.$refs['vertometerPostGlassOd'].$refs.input.style.backgroundColor = 'red'
            this.$refs['vertometerPostGlassOd2'].$refs.input.style.backgroundColor = 'red'
          }
        } else {
          this.$refs['vertometerPostGlassOd'].$refs.input.focus()
          this.$refs['vertometerPostGlassOd'].$refs.input.style.backgroundColor = 'red'
          this.$refs['vertometerPostGlassOd2'].$refs.input.style.backgroundColor = 'red'
        }
        //  左眼柱镜
        if (!isNaN(this.dataForm.vertometerPostGlassOs) && (this.saleOptometry.postGlassOs || this.saleOptometry.postGlassOs == 0)) {
          if (this.dataForm.vertometerPostGlassOs.substring(0, 1) == this.saleOptometry.postGlassOs.substring(0, 1) || this.saleOptometry.postGlassOs.substring(0, 1) == '+') {
            if (Math.abs(Subtr(this.saleOptometry.postGlassOs, this.dataForm.vertometerPostGlassOs)) > this.toleranceData.cylosmis || this.dataForm.vertometerPostGlassOs == '') {
              this.$refs['vertometerPostGlassOs'].$refs.input.focus()
              this.$refs['vertometerPostGlassOs'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerPostGlassOs2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPostGlassOs'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerPostGlassOs2'].$refs.input.style.backgroundColor = 'green'
            }
          } else if (this.saleOptometry.postGlassOs == '0.00') {
            if (Math.abs(Subtr(this.saleOptometry.postGlassOs, this.dataForm.vertometerPostGlassOs)) > this.toleranceData.cylosmis || this.dataForm.vertometerPostGlassOs == '') {
              this.$refs['vertometerPostGlassOs'].$refs.input.focus()
              this.$refs['vertometerPostGlassOs'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerPostGlassOs2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPostGlassOs'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerPostGlassOs2'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerPostGlassOs'].$refs.input.focus()
            this.$refs['vertometerPostGlassOs'].$refs.input.style.backgroundColor = 'red'
            this.$refs['vertometerPostGlassOs2'].$refs.input.style.backgroundColor = 'red'
          }
        } else {
          this.$refs['vertometerPostGlassOs'].$refs.input.focus()
          this.$refs['vertometerPostGlassOs'].$refs.input.style.backgroundColor = 'red'
          this.$refs['vertometerPostGlassOs2'].$refs.input.style.backgroundColor = 'red'
        }
        //  右眼轴向
        if (this.saleOptometry.axesOd != 0) {
          if (Math.abs(accAdd(this.saleOptometry.axesOd, this.toleranceData.axesodmis)) > 180 && Math.abs(this.dataForm.vertometerAxesOd) < 10) {
            if (Math.abs(Subtr(this.saleOptometry.axesOd, accAdd(this.dataForm.vertometerAxesOd, 180))) > this.toleranceData.axesodmis || !this.dataForm.vertometerAxesOd) {
              this.$refs['vertometerAxesOd'].$refs.input.focus()
              this.$refs['vertometerAxesOd'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerAxesOd2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerAxesOd'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerAxesOd2'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            if (Math.abs(Subtr(this.dataForm.vertometerAxesOd, this.saleOptometry.axesOd)) > this.toleranceData.axesodmis || !this.dataForm.vertometerAxesOd) {
              this.$refs['vertometerAxesOd'].$refs.input.focus()
              this.$refs['vertometerAxesOd'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerAxesOd2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerAxesOd'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerAxesOd2'].$refs.input.style.backgroundColor = 'green'
            }
          }
        } else {
          this.$refs['vertometerAxesOd'].$refs.input.style.backgroundColor = 'green'
          this.$refs['vertometerAxesOd2'].$refs.input.style.backgroundColor = 'green'
        }
        //  左眼轴向
        if (this.saleOptometry.axesOs != 0) {
          if (Math.abs(accAdd(this.saleOptometry.axesOs, this.toleranceData.axesosmis)) > 180 && Math.abs(this.dataForm.vertometerAxesOs) < 10) {
            if (Math.abs(Subtr(this.saleOptometry.axesOs, accAdd(this.dataForm.vertometerAxesOs, 180))) > this.toleranceData.axesosmis || !this.dataForm.vertometerAxesOs) {
              this.$refs['vertometerAxesOs'].$refs.input.focus()
              this.$refs['vertometerAxesOs'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerAxesOs2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerAxesOs'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerAxesOs2'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            if (Math.abs(Subtr(this.dataForm.vertometerAxesOs, this.saleOptometry.axesOs)) > this.toleranceData.axesosmis || !this.dataForm.vertometerAxesOs) {
              this.$refs['vertometerAxesOs'].$refs.input.focus()
              this.$refs['vertometerAxesOs'].$refs.input.style.backgroundColor = 'red'
              this.$refs['vertometerAxesOs2'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerAxesOs'].$refs.input.style.backgroundColor = 'green'
              this.$refs['vertometerAxesOs2'].$refs.input.style.backgroundColor = 'green'
            }
          }
        } else {
          this.$refs['vertometerAxesOs'].$refs.input.style.backgroundColor = 'green'
          this.$refs['vertometerAxesOs2'].$refs.input.style.backgroundColor = 'green'
        }
        //  右眼ADD
        if (this.saleOptometry.addOd != 0) {
          if (Math.abs(Subtr(this.saleOptometry.addOd, this.dataForm.vertometerAddOd)) > this.toleranceData.addodmis || !this.dataForm.vertometerAddOd) {
            this.$refs['vertometerAddOd'].$refs.input.focus()
            this.$refs['vertometerAddOd'].$refs.input.style.backgroundColor = 'red'
          } else {
            this.$refs['vertometerAddOd'].$refs.input.style.backgroundColor = 'green'
          }
        } else {
          this.$refs['vertometerAddOd'].$refs.input.style.backgroundColor = 'green'
        }
        //  左眼ADD
        if (this.saleOptometry.addOs != 0) {

          if (Math.abs(Subtr(this.saleOptometry.addOs, this.dataForm.vertometerAddOs)) > this.toleranceData.addosmis || !this.dataForm.vertometerAddOs) {
            this.$refs['vertometerAddOs'].$refs.input.focus()
            this.$refs['vertometerAddOs'].$refs.input.style.backgroundColor = 'red'
          } else {
            this.$refs['vertometerAddOs'].$refs.input.style.backgroundColor = 'green'
          }
        } else {
          this.$refs['vertometerAddOs'].$refs.input.style.backgroundColor = 'green'
        }
        //  右眼瞳距
        if (!isNaN(this.dataForm.vertometerPupilDistanceOd)) {
          if (parseFloat(this.saleOptometry.farPupilDistanceOd)) {
            if (Math.abs(accAdd(this.saleOptometry.farPupilDistanceOd, '-' + this.dataForm.vertometerPupilDistanceOd)) > parseFloat(this.toleranceData.tjodmis) / 2 || this.dataForm.vertometerPupilDistanceOd == '') {
              this.$refs['vertometerPupilDistanceOd'].$refs.input.focus()
              this.$refs['vertometerPupilDistanceOd'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPupilDistanceOd'].$refs.input.style.backgroundColor = 'green'
            }
          } else if (parseFloat(this.saleOptometry.nearPupilDistanceOd)) {
            if (Math.abs(accAdd(this.saleOptometry.nearPupilDistanceOd, '-' + this.dataForm.vertometerPupilDistanceOd)) > parseFloat(this.toleranceData.tjodmis) / 2 || this.dataForm.vertometerPupilDistanceOd == '') {
              this.$refs['vertometerPupilDistanceOd'].$refs.input.focus()
              this.$refs['vertometerPupilDistanceOd'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPupilDistanceOd'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerPupilDistanceOd'].$refs.input.style.backgroundColor = 'green'
          }
        } else {
          this.$refs['vertometerPupilDistanceOd'].$refs.input.focus()
          this.$refs['vertometerPupilDistanceOd'].$refs.input.style.backgroundColor = 'red'
        }
        //  左眼瞳距
        if (!isNaN(this.dataForm.vertometerPupilDistanceOs)) {
          if (parseFloat(this.saleOptometry.farPupilDistanceOs)) {
            if (Math.abs(accAdd(this.saleOptometry.farPupilDistanceOs, '-' + this.dataForm.vertometerPupilDistanceOs)) > parseFloat(this.toleranceData.tjosmis) / 2 || this.dataForm.vertometerPupilDistanceOs == '') {
              this.$refs['vertometerPupilDistanceOs'].$refs.input.focus()
              this.$refs['vertometerPupilDistanceOs'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPupilDistanceOs'].$refs.input.style.backgroundColor = 'green'
            }
          } else if (parseFloat(this.saleOptometry.nearPupilDistanceOs)) {
            if (Math.abs(accAdd(this.saleOptometry.nearPupilDistanceOs, '-' + this.dataForm.vertometerPupilDistanceOs)) > parseFloat(this.toleranceData.tjosmis) / 2 || this.dataForm.vertometerPupilDistanceOs == '') {
              this.$refs['vertometerPupilDistanceOs'].$refs.input.focus()
              this.$refs['vertometerPupilDistanceOs'].$refs.input.style.backgroundColor = 'red'
            } else {
              this.$refs['vertometerPupilDistanceOs'].$refs.input.style.backgroundColor = 'green'
            }
          } else {
            this.$refs['vertometerPupilDistanceOs'].$refs.input.style.backgroundColor = 'green'
          }
        } else {
          this.$refs['vertometerPupilDistanceOs'].$refs.input.focus()
          this.$refs['vertometerPupilDistanceOs'].$refs.input.style.backgroundColor = 'red'
        }
        //  判断垂差
        if (!isNaN(this.dataForm.cokeCenterVertical) && (this.dataForm.cokeCenterVertical || this.dataForm.cokeCenterVertical == 0)) {
          if (parseFloat(this.dataForm.cokeCenterVertical) > parseFloat(this.centerVertical)) {
            this.$refs['cokeCenterVertical'].$refs.input.focus()
            this.$refs['cokeCenterVertical'].$refs.input.style.backgroundColor = 'red'
          } else {
            this.$refs['cokeCenterVertical'].$refs.input.style.backgroundColor = 'green'
          }
        } else {
          this.$refs['cokeCenterVertical'].$refs.input.focus()
          this.$refs['cokeCenterVertical'].$refs.input.style.backgroundColor = 'red'
        }
      },
      // 表单提交
      dataFormSubmit() {
        this.check()
        let i = 0;
        let optoList = document.getElementsByName('opto')
        optoList.forEach(item => {
          if (item.style.backgroundColor == 'green') {
            i += 1
          }
        })
        if (!this.dataForm.workUserName) {
          this.dataForm.workUserId = this.userInfo.id
        }
        if (i == 17) {
          this.dataForm.cokeBallGlassOd = this.saleOptometry.ballGlassOd
          this.dataForm.cokeBallGlassOs = this.saleOptometry.ballGlassOs
          this.dataForm.cokePostGlassOd = this.saleOptometry.postGlassOd
          this.dataForm.cokePostGlassOs = this.saleOptometry.postGlassOs
          this.dataForm.cokeAxesOd = this.saleOptometry.axesOd
          this.dataForm.cokeAxesOs = this.saleOptometry.axesOs
          this.dataForm.cokeAddOd = this.saleOptometry.addOd
          this.dataForm.cokeAddOs = this.saleOptometry.addOs
          this.dataForm.cokePupilDistanceOd = this.saleOptometry.farPupilDistanceOd != null ? this.saleOptometry.farPupilDistanceOd :
            this.saleOptometry.nearPupilDistanceOd
          this.dataForm.cokePupilDistanceOs = this.saleOptometry.farPupilDistanceOd != null ? this.saleOptometry.farPupilDistanceOs :
            this.saleOptometry.nearPupilDistanceOs
          this.dataForm.cokeBallGlassOd2 = this.ballGlassOd2
          this.dataForm.cokePostGlassOd2 = this.postGlassOd2
          this.dataForm.cokeAxesOd2 = this.axesOd2
          this.dataForm.cokeBallGlassOs2 = this.ballGlassOs2
          this.dataForm.cokePostGlassOs2 = this.postGlassOs2
          this.dataForm.cokeAxesOs2 = this.axesOs2
          this.dataForm.checkUserName = this.checkName
          this.dataForm.checkUserId = this.userInfo.id

          this.ischeck = true

          workCheckAddObj(this.dataForm).then(response => {
            if(response.data.code == '0'){
              this.$message.success('添加成功')
              this.visible = false
              this.$emit('refreshDataList')
            }else{
              this.$message.error(response.data.msg)
            }
            this.ischeck = false
          }).catch(() => {
            this.ischeck = false
          })
        } else {
          this.$message.warning('请检查不在允差范围内的信息')
        }
      },
      //  回车切换
      enterChange(num) {
        document.getElementById('opto' + num).focus()
      }
    }
  }
</script>

<style lang="scss" scoped>
  .miui-table {
    width: 100%;
  }

  .miui-table tr>th,
  .miui-table tr>td {
    border: solid 1px #e7e7e7;
    background-color: #ecf5ff;
    padding: 3px 5px;
    text-align: center;
  }
</style>
